package com.aode.common.bean.response;



import android.os.Parcel;
import android.os.Parcelable;
import android.widget.ImageView;

import androidx.databinding.BaseObservable;
import androidx.databinding.Bindable;
import androidx.databinding.BindingAdapter;

import com.aode.common.url.UrlGather;
import com.bumptech.glide.Glide;


/**
 * <p>
 * 
 * </p>
 *
 * @author qingmu
 * @since 2021-12-19
 */
public class Mllist extends BaseObservable implements Parcelable {

    public Mllist(){

    }
    /**
     * 主键
     */
    private Integer mlistId;
    /**
     * 标题
     */
    private String mlistTitle;
    /**
     * 歌单图片
     */
    private String mlistPic;
    @BindingAdapter({"imagepath"})
    public static void loadImage(ImageView imageView,String imageUrl){
        Glide.with(imageView.getContext()).load(UrlGather.BASE_URL+imageUrl).into(imageView);
    }
    /**
     * 简介
     */
    private String mlistIntroduction;
    /**
     * 风格
     */
    private String mlistStyle;


    private Integer userId;

    protected Mllist(Parcel in) {
        if (in.readByte() == 0) {
            mlistId = null;
        } else {
            mlistId = in.readInt();
        }
        mlistTitle = in.readString();
        mlistPic = in.readString();
        mlistIntroduction = in.readString();
        mlistStyle = in.readString();
        if (in.readByte() == 0) {
            userId = null;
        } else {
            userId = in.readInt();
        }
    }

    public static final Creator<Mllist> CREATOR = new Creator<Mllist>() {
        @Override
        public Mllist createFromParcel(Parcel in) {
            return new Mllist(in);
        }

        @Override
        public Mllist[] newArray(int size) {
            return new Mllist[size];
        }
    };

    public Integer getMlistId() {
        return mlistId;
    }

    public void setMlistId(Integer mlistId) {
        this.mlistId = mlistId;
    }

    @Bindable
    public String getMlistTitle() {
        return mlistTitle;
    }

    public void setMlistTitle(String mlistTitle) {
        this.mlistTitle = mlistTitle;
    }
    @Bindable
    public String getMlistPic() {
        return mlistPic;
    }

    public void setMlistPic(String mlistPic) {
        this.mlistPic = mlistPic;
    }

    public String getMlistIntroduction() {
        return mlistIntroduction;
    }

    public void setMlistIntroduction(String mlistIntroduction) {
        this.mlistIntroduction = mlistIntroduction;
    }

    public String getMlistStyle() {
        return mlistStyle;
    }

    public void setMlistStyle(String mlistStyle) {
        this.mlistStyle = mlistStyle;
    }

    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    @Override
    public String toString() {
        return "Mllist{" +
        ", mlistId=" + mlistId +
        ", mlistTitle=" + mlistTitle +
        ", mlistPic=" + mlistPic +
        ", mlistIntroduction=" + mlistIntroduction +
        ", mlistStyle=" + mlistStyle +
        "}";
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        if (mlistId == null) {
            dest.writeByte((byte) 0);
        } else {
            dest.writeByte((byte) 1);
            dest.writeInt(mlistId);
        }
        dest.writeString(mlistTitle);
        dest.writeString(mlistPic);
        dest.writeString(mlistIntroduction);
        dest.writeString(mlistStyle);
        if (userId == null) {
            dest.writeByte((byte) 0);
        } else {
            dest.writeByte((byte) 1);
            dest.writeInt(userId);
        }
    }
}
